#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct node
{
     char value;
     struct node *next;
} node;

node *stack_create();
int stack_push(node *cur, char op);
void stack_show(node *cur);
int func(char *str,node *stack);

int main(void)
{
     node *current = stack_create();
     char *str = "(){}[]";
     int len = strlen(str);
     for (int i = 0; i < len; i++)
          stack_push(current, str[i]);
     stack_show(current);
     return 0;
}

node *stack_create()
{
     node *current = malloc(sizeof(node));
     if (current == NULL)
          return NULL;
     current->next = NULL;
     return current;
}

int stack_push(node *stack, char op)
{
     node *current = malloc(sizeof(node));
     if (current == NULL)
          return -1;
     current->value = op;

     node *ptr = stack->next;
     if (ptr == NULL)
     {
          current->next = NULL;
          stack->next = current;
     }
     else
     {
          current->next = ptr;
          stack->next = current;
     }
     return 0;
}

void stack_show(node *cur)
{
     node *current = cur->next;
     while (current != NULL)
     {
          printf("%c", current->value);
          current = current->next;
     }
     putchar('\n');
}

int func(char *str,node *stack,int len)
{
     while()
     stack_push();
}